package com.community.body.service.impl;

import java.util.Arrays;
import java.util.List;

import com.community.body.domain.ZyOwnerRoom;
import com.community.body.dto.CheckDTO;
import com.community.body.mapper.ZyOwnerRoomMapper;
import com.community.body.service.IZyOwnerRoomService;
import com.community.body.vo.BindingVO;
import com.community.body.vo.EchartsVo;
import com.community.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 房屋绑定 Service业务层处理
 * 
 * @author community
 * @date 2024-04-11
 */
@Service
public class ZyOwnerRoomServiceImpl implements IZyOwnerRoomService
{
    @Resource
    private ZyOwnerRoomMapper zyOwnerRoomMapper;

    /**
     * 查询房屋绑定 
     * 
     * @param ownerRoomId 房屋绑定 主键
     * @return 房屋绑定 
     */
    @Override
    public ZyOwnerRoom selectZyOwnerRoomByOwnerRoomId(Long ownerRoomId)
    {
        return zyOwnerRoomMapper.selectZyOwnerRoomByOwnerRoomId(ownerRoomId);
    }

    /**
     * 查询房屋绑定 列表
     * 
     * @param checkDTO 房屋绑定
     * @return 房屋绑定 
     */
    @Override
    public List<CheckDTO> selectZyOwnerRoomList(CheckDTO checkDTO)
    {
        if("admin".equals(checkDTO.getUserName()) && checkDTO.getUserName() != null){
            checkDTO.setDeptId(0);
        }
        return zyOwnerRoomMapper.selectZyOwnerRoomList(checkDTO);
    }

    /**
     * 新增房屋绑定 
     * 
     * @param zyOwnerRoom 房屋绑定 
     * @return 结果
     */
    @Override
    public int insertZyOwnerRoom(ZyOwnerRoom zyOwnerRoom)
    {
        zyOwnerRoom.setCreateTime(DateUtils.getNowDate());
        return zyOwnerRoomMapper.insertZyOwnerRoom(zyOwnerRoom);
    }

    /**
     * 修改房屋绑定 
     * 
     * @param zyOwnerRoom 房屋绑定 
     * @return 结果
     */
    @Override
    public int updateZyOwnerRoom(ZyOwnerRoom zyOwnerRoom)
    {
        zyOwnerRoom.setUpdateTime(DateUtils.getNowDate());
        return zyOwnerRoomMapper.updateZyOwnerRoom(zyOwnerRoom);
    }

    /**
     * 批量删除房屋绑定 
     * 
     * @param ownerRoomIds 需要删除的房屋绑定 主键
     * @return 结果
     */
    @Override
    public int deleteZyOwnerRoomByOwnerRoomIds(Long[] ownerRoomIds)
    {
        return zyOwnerRoomMapper.deleteZyOwnerRoomByOwnerRoomIds(ownerRoomIds);
    }

    /**
     * 删除房屋绑定 信息
     * 
     * @param ownerRoomId 房屋绑定 主键
     * @return 结果
     */
    @Override
    public int deleteZyOwnerRoomByOwnerRoomId(Long ownerRoomId)
    {
        return zyOwnerRoomMapper.deleteZyOwnerRoomByOwnerRoomId(ownerRoomId);
    }

    @Override
    public List<BindingVO> getStatusList(ZyOwnerRoom zyOwnerRoom) {

        return zyOwnerRoomMapper.getStatusList(zyOwnerRoom);
    }
}
